\(\int \cos ^2(e+f x) (a+b \sec ^2(e+f x))^2 \, dx\) [175]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 23, antiderivative size = 47 \[ \int \cos ^2(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=\frac {1}{2} a (a+4 b) x+\frac {a^2 \cos (e+f x) \sin (e+f x)}{2 f}+\frac {b^2 \tan (e+f x)}{f} \]

[Out]

1/2*a*(a+4*b)*x+1/2*a^2*cos(f*x+e)*sin(f*x+e)/f+b^2*tan(f*x+e)/f

Rubi [A] (verified)

Time = 0.09 (sec) , antiderivative size = 47, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.174, Rules used = {4231, 398, 393, 209} \[ \int \cos ^2(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=\frac {a^2 \sin (e+f x) \cos (e+f x)}{2 f}+\frac {1}{2} a x (a+4 b)+\frac {b^2 \tan (e+f x)}{f} \]

[In]

Int[Cos[e + f*x]^2*(a + b*Sec[e + f*x]^2)^2,x]

[Out]

(a*(a + 4*b)*x)/2 + (a^2*Cos[e + f*x]*Sin[e + f*x])/(2*f) + (b^2*Tan[e + f*x])/f

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 393

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[(-(b*c - a*d))*x*((a + b*x^n)^(p
 + 1)/(a*b*n*(p + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(a*b*n*(p + 1)), Int[(a + b*x^n)^(p + 1), x], x]
 /; FreeQ[{a, b, c, d, n, p}, x] && NeQ[b*c - a*d, 0] && (LtQ[p, -1] || ILtQ[1/n + p, 0])

Rule 398

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> Int[PolynomialDivide[(a + b*x^n)
^p, (c + d*x^n)^(-q), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && IGtQ[p, 0] && ILt
Q[q, 0] && GeQ[p, -q]

Rule 4231

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*sec[(e_.) + (f_.)*(x_)]^(n_))^(p_), x_Symbol] :> With[{ff = Fre
eFactors[Tan[e + f*x], x]}, Dist[ff/f, Subst[Int[(1 + ff^2*x^2)^(m/2 - 1)*ExpandToSum[a + b*(1 + ff^2*x^2)^(n/
2), x]^p, x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, p}, x] && IntegerQ[m/2] && IntegerQ[n/2]

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \frac {\left (a+b+b x^2\right )^2}{\left (1+x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {\text {Subst}\left (\int \left (b^2+\frac {a (a+2 b)+2 a b x^2}{\left (1+x^2\right )^2}\right ) \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {b^2 \tan (e+f x)}{f}+\frac {\text {Subst}\left (\int \frac {a (a+2 b)+2 a b x^2}{\left (1+x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {a^2 \cos (e+f x) \sin (e+f x)}{2 f}+\frac {b^2 \tan (e+f x)}{f}+\frac {(a (a+4 b)) \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{2 f} \\ & = \frac {1}{2} a (a+4 b) x+\frac {a^2 \cos (e+f x) \sin (e+f x)}{2 f}+\frac {b^2 \tan (e+f x)}{f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.16 (sec) , antiderivative size = 52, normalized size of antiderivative = 1.11 \[ \int \cos ^2(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=2 a b x+\frac {a^2 (e+f x)}{2 f}+\frac {a^2 \sin (2 (e+f x))}{4 f}+\frac {b^2 \tan (e+f x)}{f} \]

[In]

Integrate[Cos[e + f*x]^2*(a + b*Sec[e + f*x]^2)^2,x]

[Out]

2*a*b*x + (a^2*(e + f*x))/(2*f) + (a^2*Sin[2*(e + f*x)])/(4*f) + (b^2*Tan[e + f*x])/f

Maple [A] (verified)

Time = 0.42 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.09

method result size
derivativedivides \(\frac {a^{2} \left (\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )+2 a b \left (f x +e \right )+b^{2} \tan \left (f x +e \right )}{f}\) \(51\)
default \(\frac {a^{2} \left (\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )+2 a b \left (f x +e \right )+b^{2} \tan \left (f x +e \right )}{f}\) \(51\)
parallelrisch \(\frac {\sin \left (3 f x +3 e \right ) a^{2}+4 a f x \left (a +4 b \right ) \cos \left (f x +e \right )+\sin \left (f x +e \right ) \left (a^{2}+8 b^{2}\right )}{8 f \cos \left (f x +e \right )}\) \(60\)
risch \(\frac {a^{2} x}{2}+2 x a b -\frac {i {\mathrm e}^{2 i \left (f x +e \right )} a^{2}}{8 f}+\frac {i {\mathrm e}^{-2 i \left (f x +e \right )} a^{2}}{8 f}+\frac {2 i b^{2}}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}\) \(71\)
norman \(\frac {\left (-\frac {1}{2} a^{2}-2 a b \right ) x +\left (-\frac {1}{2} a^{2}-2 a b \right ) x \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{8}+\left (\frac {1}{2} a^{2}+2 a b \right ) x \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}+\left (\frac {1}{2} a^{2}+2 a b \right ) x \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{10}+\left (-a^{2}-4 a b \right ) x \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{6}+\left (a^{2}+4 a b \right ) x \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{4}+\frac {4 a^{2} \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}}{f}+\frac {4 a^{2} \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{7}}{f}-\frac {\left (a^{2}+2 b^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{f}-\frac {\left (a^{2}+2 b^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{9}}{f}-\frac {2 \left (3 a^{2}-2 b^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{5}}{f}}{\left (1+\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}\right )^{2} \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}-1\right )^{3}}\) \(271\)

[In]

int(cos(f*x+e)^2*(a+b*sec(f*x+e)^2)^2,x,method=_RETURNVERBOSE)

[Out]

1/f*(a^2*(1/2*sin(f*x+e)*cos(f*x+e)+1/2*f*x+1/2*e)+2*a*b*(f*x+e)+b^2*tan(f*x+e))

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 56, normalized size of antiderivative = 1.19 \[ \int \cos ^2(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=\frac {{\left (a^{2} + 4 \, a b\right )} f x \cos \left (f x + e\right ) + {\left (a^{2} \cos \left (f x + e\right )^{2} + 2 \, b^{2}\right )} \sin \left (f x + e\right )}{2 \, f \cos \left (f x + e\right )} \]

[In]

integrate(cos(f*x+e)^2*(a+b*sec(f*x+e)^2)^2,x, algorithm="fricas")

[Out]

1/2*((a^2 + 4*a*b)*f*x*cos(f*x + e) + (a^2*cos(f*x + e)^2 + 2*b^2)*sin(f*x + e))/(f*cos(f*x + e))

Sympy [F]

\[ \int \cos ^2(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=\int \left (a + b \sec ^{2}{\left (e + f x \right )}\right )^{2} \cos ^{2}{\left (e + f x \right )}\, dx \]

[In]

integrate(cos(f*x+e)**2*(a+b*sec(f*x+e)**2)**2,x)

[Out]

Integral((a + b*sec(e + f*x)**2)**2*cos(e + f*x)**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 53, normalized size of antiderivative = 1.13 \[ \int \cos ^2(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=\frac {2 \, b^{2} \tan \left (f x + e\right ) + {\left (a^{2} + 4 \, a b\right )} {\left (f x + e\right )} + \frac {a^{2} \tan \left (f x + e\right )}{\tan \left (f x + e\right )^{2} + 1}}{2 \, f} \]

[In]

integrate(cos(f*x+e)^2*(a+b*sec(f*x+e)^2)^2,x, algorithm="maxima")

[Out]

1/2*(2*b^2*tan(f*x + e) + (a^2 + 4*a*b)*(f*x + e) + a^2*tan(f*x + e)/(tan(f*x + e)^2 + 1))/f

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 53, normalized size of antiderivative = 1.13 \[ \int \cos ^2(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=\frac {2 \, b^{2} \tan \left (f x + e\right ) + {\left (a^{2} + 4 \, a b\right )} {\left (f x + e\right )} + \frac {a^{2} \tan \left (f x + e\right )}{\tan \left (f x + e\right )^{2} + 1}}{2 \, f} \]

[In]

integrate(cos(f*x+e)^2*(a+b*sec(f*x+e)^2)^2,x, algorithm="giac")

[Out]

1/2*(2*b^2*tan(f*x + e) + (a^2 + 4*a*b)*(f*x + e) + a^2*tan(f*x + e)/(tan(f*x + e)^2 + 1))/f

Mupad [B] (verification not implemented)

Time = 18.78 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.40 \[ \int \cos ^2(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=\frac {b^2\,\mathrm {tan}\left (e+f\,x\right )}{f}+\frac {a^2\,\sin \left (2\,e+2\,f\,x\right )}{4\,f}+\frac {a\,\mathrm {atan}\left (\frac {a\,\mathrm {tan}\left (e+f\,x\right )\,\left (a+4\,b\right )}{2\,\left (\frac {a^2}{2}+2\,b\,a\right )}\right )\,\left (a+4\,b\right )}{2\,f} \]

[In]

int(cos(e + f*x)^2*(a + b/cos(e + f*x)^2)^2,x)

[Out]

(b^2*tan(e + f*x))/f + (a^2*sin(2*e + 2*f*x))/(4*f) + (a*atan((a*tan(e + f*x)*(a + 4*b))/(2*(2*a*b + a^2/2)))*
(a + 4*b))/(2*f)